package com.guowei.jiecloudbackstage.staff.mapper;

import com.guowei.jiecloudbackstage.staff.entity.Staff;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ym
 * @since 2021-04-25
 */
public interface StaffMapper extends BaseMapper<Staff> {

    /**
     * 查询全部管理员信息
     * @param staff
     * @return
     */
    Staff Login(Staff staff);

    /**
     * 获取全部管理员信息
     * @return
     */
    @Select("select * from staff")
    List<Staff> getAllAdmin();

    /**
     * 根据id删除管理员
     * @param id
     * @return
     */
    @Delete("delete from staff where staffId = #{staffId}")
    int deleteAdminById(Staff staff);

    /**
     * 新增管理员信
     * @param staff
     * @return
     */
    @Insert("INSERT INTO `hotel`.`staff`(`staffLoginName`, `staffLoginPwd`, `staffName`, `sex`, `phone`, `position`) VALUES (#{staffLoginName}, #{staffLoginPwd}, #{staffName}, #{sex}, #{phone}, #{position})")
    int addAdmin(Staff staff);

    /**
     * 根据id修改管理员信息
     * @param staff
     * @return
     */
    int updateAdminById(Staff staff);

}
